﻿@model PaggerApplication.Models.PageViewModel<PaggerApplication.Models.ProductModel>
@{
    PaggerApplication.Models.SearchModel searchModel = ViewBag.SearchModel;
    if ( searchModel == null ) {
        searchModel = new PaggerApplication.Models.SearchModel ();
    }
    ViewBag.Title = "Numeric Post";
    Layout = "~/Views/Shared/_HtmlLayout.cshtml";
}
<h2>
    Numeric Pagger - Post</h2>
@using ( Html.BeginForm () ) {
    @(Html.ValidationSummary ( true, "Search Condition Error." ))
    <div>
        <fieldset>
            <legend>Search Product</legend>
            <div class="editor-field">
                <span>Count</span>
                <input type="text" name="MinCount" value="@searchModel.MinCount" />
                <span>~ </span>
                <input type="text" name="MaxCount" value="@searchModel.MaxCount" />
                <input type="submit" value="Query" />
            </div>
        </fieldset>
    </div>
}
<table>
    <thead>
        <tr>
            <th>
                ID
            </th>
            <th>
                Name
            </th>
            <th>
                Specification
            </th>
            <th>
                Price
            </th>
            <th>
                Count
            </th>
        </tr>
    </thead>
    <tbody>
        @if ( Model.Data != null && Model.Data.Count () > 0 ) {
            foreach ( var product in Model.Data ) {
            <tr>
                <td>@product.ID
                </td>
                <td>@product.Name
                </td>
                <td>@product.Specification
                </td>
                <td>@(String.Format ( "{0:c2}", product.Price ))
                </td>
                <td>@product.Count
                </td>
            </tr>
            }
        }
    </tbody>
</table>
@Html.Pagger( Model.RowCount, Model.PageIndex, Model.PageSize, HtmlPaggerType.Numeric, HttpMethod.POST, PageButtonLabel.Default ) 